ComponentOne Data Source for Entity Framework
C1.LiveLinq Namespace / LiveViewExtensions Class / LiveMax Method / LiveMax<TSource>(View<TSource>,Expression<Func<TSource,Nullable<Int64>>>) Method
The type of the elements of source.
A view containing the values to determine the maximum value of.
A transform function to apply to each element.

In This Topic
    LiveMax<TSource>(View<TSource>,Expression<Func<TSource,Nullable<Int64>>>) Method
    In This Topic
    Computes the maximum value of a view of nullable System.Int64 values that are obtained by invoking a transform function on each element of the source view.
    Syntax
    'Declaration
     
    
    Public Overloads Shared Function LiveMax(Of TSource)( _
       ByVal source As View(Of TSource), _
       ByVal selector As System.Linq.Expressions.Expression(Of Func(Of TSource,Nullable(Of Long))) _
    ) As AggregationView(Of TSource,Nullable(Of Long))
    public static AggregationView<TSource,Nullable<long>> LiveMax<TSource>( 
       View<TSource> source,
       System.Linq.Expressions.Expression<Func<TSource,Nullable<long>>> selector
    )

    Parameters

    source
    A view containing the values to determine the maximum value of.
    selector
    A transform function to apply to each element.

    Type Parameters

    TSource
    The type of the elements of source.

    Return Value

    A view representing the maximum of the values.
    Remarks

    If the source is empty or contains only nulls, the maximum value is null.

    It is possible to use standard LINQ query operator Max instead of LiveMax. Both are "live" in the sense that they are recomputed automatically when any change occurs in the source. The difference is that Max will every time loop through the entire source collection and aggregate it from scratch, whereas LiveMax will use a more performant algorithm, will maintain its value incrementally, processing only those source items that actually changed.

    See Also